import controller.LCD
from controller.info import state_string, changeMode, changeTarTemp,closeSystem
from controller.ws import create_connection
from controller.LCD import Command

controller.LCD.set_color(7)

#begin
controller.LCD.clear()

ON = False

print("start")

while 1:
    controller.LCD.set_message(state_string())
    f = controller.LCD.get_input()
    if f == Command.UP and ON:
        changeTarTemp(1)
    elif f == Command.DOWN and ON:
        changeTarTemp(-1)
    elif f == Command.ON and (not ON):
        create_connection()
        ON = True
    elif f == Command.MODE and ON:
        changeMode()
    elif f == Command.OFF and ON:
        ON = False
        closeSystem()
        pass
    pass